package com.study.proxy.general;

/**
 * 动态代理
 * 对目标对象的保护
 * 对目标对象的增强
 */
public class Proxy implements ISubject{
    private ISubject subject;

    public Proxy(ISubject subject){
        this.subject = subject;
    }

    @Override
    public void request() {
        before();
        subject.request();
        after();
    }

    private void before() {
        System.out.println("before doing...");
    }

    private void after() {
        System.out.println("after doing...");
    }
}
